package first.group.ssh.packet;

import first.group.ssh.SSHConsts;
import first.group.ssh.packet.writer.StringWriter;
import java.nio.ByteBuffer;

public class UserAuthRequestPacket extends Packet {
    
    public final String userName;
    public final String serviceName;
    public final String methodName;
    public final byte[] payload;

    public UserAuthRequestPacket(String userName, String serviceName, String methodName, byte[] payload) {
        super(SSHConsts.SSH_MSG_USERAUTH_REQUEST);
        this.userName = userName;
        this.serviceName = serviceName;
        this.methodName = methodName;
        this.payload = payload;
    }

    @Override
    public void write(ByteBuffer buffer) {
        StringWriter.writeString(buffer, userName);
        StringWriter.writeString(buffer, serviceName);
        StringWriter.writeString(buffer, methodName);
        buffer.put(payload);
    }
}
